@if ($menus)
    <ul class="nav navbar-nav navbar-top-links navbar-left admin-top-nav hidden-xs" id="admin-nav">
        @foreach($menus as $item)
            <li role="presentation" class="dropdown @if($item['id'] == $menu_parent_id) active @endif">
                <?php
                $first_url = array_get($item, 'url');
                $first = array_get($item, 'children');
                while ((empty($first_url) || $first_url == '#') && $first && is_array($first)) {
                    $first     = reset($first);
                    $first_url = array_get($first, 'url', '#');
                    $first     = array_get($first, 'children');
                }
                ?>
                <a href="{{ url($first_url ?: '#') }}">
                    <i class="fa {{ array_get($item, 'icon') }}"></i>
                    <span>
                        {{ trans(array_get($item, 'name')) }}
                    </span>
                </a>
                @if (!empty($item['children']))
                    <div class="dropdown-menu dropdown-admin-div">
                        @foreach ($item['children'] as $children)
                            <ul class="pull-left text-left admin-ul">
                                @if ($child_list = array_get($children, 'children'))
                                    <li class="first">
                                        <i class="fa {{  $children['icon'] ?: 'fa-circle-o' }} fa-fw"></i>
                                        {{ $children['name'] }}
                                    </li>
                                    @foreach ($child_list as $child)
                                        <li @if($child['id'] == $menu_id) class="active" @endif>
                                            <a href="{{ url($child['url']) }}">
                                                <i class="fa {{  $child['icon'] ?: 'fa-circle-o' }} fa-fw"></i>
                                                {{ $child['name'] }}
                                            </a>
                                        </li>
                                    @endforeach
                                @else
                                    <li class="first-parent @if($children['id'] == $menu_id) active @endif ">
                                        <a href="{{ url($children['url']) }}">
                                            <i class="fa {{  $children['icon'] ?: 'fa-circle-o' }} fa-fw"></i>
                                            {{ $children['name'] }}
                                        </a>
                                    </li>
                                @endif
                            </ul>
                        @endforeach
                    </div>
                @endif
            </li>
        @endforeach
    </ul>
@endif
